package lims.cloud.system.base.mybatis;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lims.cloud.system.department.Department;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class IBaseControllerImpl<T extends IBaseEntity<T>, M extends IBaseService<T>> implements IBaseController<T> {

    private final M iBaseService;

    public IBaseControllerImpl(M iBaseService) {
        this.iBaseService = iBaseService;
    }

    @Override
    public Result<T> getOneByCondition(String columnName, Object columnValue) {
        return iBaseService.getOneByCondition(columnName, columnValue);
    }

    @Override
    public Result<List<T>> getListByCondition(String columnName, Object columnValue) {
        return iBaseService.getListByCondition(columnName, columnValue);
    }

    @Override
    public Result<T> getOneByConditions(T conditions) {
        return iBaseService.getOneByConditions(conditions);
    }

    @Override
    public Result<List<T>> getListByConditions(T conditions) {
        return iBaseService.getListByConditions(conditions);
    }

    @Override
    public Result<IPage<T>> getListByConditionsWithPage(T conditions) {
        return iBaseService.getListByConditionsWithPage(conditions);
    }

    @Override
    public Result<T> insertOne(T entity) {
        return iBaseService.insertOne(entity);
    }

    @Override
    public Result<T> updateOne(T entity) {
        return iBaseService.updateOne(entity);
    }

    @Override
    public Result<?> physicalDeleteById(Long id) {
        return iBaseService.physicalDeleteById(id);
    }

    @Override
    public Result<?> logicalDeleteById(Long id) {
        return iBaseService.logicalDeleteById(id);
    }

    @Override
    public Result<?> activeById(Long id) {
        return iBaseService.activeById(id);
    }

    @Override
    public Result<?> deleteByKeyValue(String key, Object value) {
        return iBaseService.deleteByKeyValue(key, value);
    }

    @Override
    public Result<List<Department>> getTree() {
        return null;
    }
}
